report.progress<-function(count, totalcount, intervals=100, digits=0){
	markers<-round(seq(1,totalcount,length.out=intervals))
	if (any(markers==count)) cat(paste(round(count/totalcount*100, digits), "% complete \n", sep=""))
	}# close report.progress function


# note: to generate the plot properly, chart.progress must first be called when count=1 and must end with count=totalcount.

chart.progress<-function(count, totalcount, process="Current Process"){
	markers<-round(seq(0,totalcount,length.out=100))
	if (count==1) {
		quartz(width=5, height=1)
		par(mgp=c(3,0,0), lend=2, mar=c(2,2,2,2))
		plot(x=markers, y=markers, type="n", bty="n", xaxt="n", yaxt="n", xlab="", ylab="", main=process)
		rect(0,0,markers,markers, col="#CBC9E2", border=NA)
		} # close count==1 condition
		
	if (any(markers==count)) rect(0,0,count,markers, col="#6A51A3", border=NA)

	if (count==totalcount) dev.off() # turn off plotting space

	} # close chart.progress function

